import 'package:flutter/material.dart';

import 'common_item_form.dart';

class CommonRadioFormItem extends StatelessWidget {
  final String? label;
  final List<String>? options;
  final int? value;
  final ValueChanged<int?>? onChange;

  const CommonRadioFormItem(
      {super.key, this.label, this.options, this.value, this.onChange});

  @override
  Widget build(BuildContext context) {
    return CommonItemForm(
        label: label,
        contentBuilder: (context) => Row(
              mainAxisAlignment: MainAxisAlignment.spaceAround,
              children: List.generate(
                options!.length,
                (index) => Row(
                  children: [
                    Radio(value: index, groupValue: value, onChanged: onChange),
                    Text(options![index])
                  ],
                ),
              ),
            ));
  }
}
